-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New Project > Select Repository #4443
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
4f6d80b
to
0d15bc6
Compare
|
||
//#region Projects concerns | ||
// | ||
async getProviderRepositoriesForUser(params: { provider: string }): Promise<ProviderRepository[]> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is implemented in EE space because the github-app.ts is also there.
@svenefftinge, it's ok to move the github-app.ts to the non-EE sources?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great to see this coming to life @AlexTugarev! Left some minor UX comments below. 🏀
</div> | ||
<div className="p-3 bg-gray-100"> | ||
<div className="text-gray-500 text-center"> | ||
Repository not found? <a href="javascript:void(0)" onClick={e => reconfigure()} className="text-gray-400 underline underline-thickness-thin underline-offset-small hover:text-gray-600">Reconfigure</a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: Is it possible to switch to the org where the app has been installed after installing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.
When selecting Reconfigure
and editing the installations of the App on GH, you may have either:
- Install on new Account/Org
- Selected additional Repos (or selected all)
- Deleted the installation from an Account/Org
All these kinds of changes needs to be reflected in the action (Reconfigure) and also updated after the action is finished, which I doubt happens in all cases. At least after deletion, we're not getting redirected :-( So in that case, where the user does (need to) close the GH pop-up window, we need to update!
</div> | ||
<div className="w-4/12 flex justify-end"> | ||
<div className="flex self-center hover:bg-gray-200 dark:hover:bg-gray-700 rounded-md cursor-pointer opacity-0 group-hover:opacity-100"> | ||
<button className="primary py-1" onClick={() => selectRepo(r)}>Select</button> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thought: If we don't use any other label for this button we could remove it and use the whole div as a hyperlink as done with similar modals (see new workspace, parallel workspaces, etc).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would that apply to the Select Team
page as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case the project is already part of a team we could trigger a modal with a CTA button to request access to the team, instead of having conditional buttons here Add Project and Select Team. WDYT?
45d6156
to
9e6aaab
Compare
@gtsiolis, thanks for bringing this up! It's a rather conceptual question, so let's discuss. If a repository (aka project) is already linked to a team, what is the implication to the overall concept and the creation flow?Potentially incomplete list of options:
|
/werft run 👍 started the job as gitpod-build-at-select-repo.40 |
9366cd1
to
1bb1af2
Compare
|
|
@svenefftinge, that is true as long as the gitpod-dev OAuth app isn't approved for the org. On https://at-select-repo.staging.gitpod-dev.com/integrations you can select |
4c50602
to
a61e38a
Compare
@svenefftinge, I updated the PR with following changes:
I'm not sure, what that means. The
That should be solved now.
That might be just related to the missing org, I suppose. In general it takes up to seconds if you have many orgs accessible to the OAuth App of the Gitpod installation.
Done. They should be selected now properly. Also adding
This is fixed in the sense that known orgs are preserved on backend now. |
@svenefftinge and @gtsiolis, I aligned with /new-teams on that. I'm happy to reduce the menus. For both? |
195d90a
to
255d021
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works well. It needs additional passes, of course, but since it is not activated / visible by default it would be good to merge ASAP. So we can iterate in smaller batches.
@@ -11,7 +11,7 @@ export class TeamsAndProjects1622468446118 implements MigrationInterface { | |||
public async up(queryRunner: QueryRunner): Promise<any> { | |||
await queryRunner.query("CREATE TABLE IF NOT EXISTS `d_b_team` (`id` char(36) NOT NULL, `name` varchar(255) NOT NULL, `slug` varchar(255) NOT NULL, `creationTime` varchar(255) NOT NULL, `deleted` tinyint(4) NOT NULL DEFAULT '0', `_lastModified` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), PRIMARY KEY (`id`), KEY `ind_dbsync` (`_lastModified`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;"); | |||
await queryRunner.query("CREATE TABLE IF NOT EXISTS `d_b_team_membership` (`id` char(36) NOT NULL, `teamId` char(36) NOT NULL, `userId` char(36) NOT NULL, `role` varchar(255) NOT NULL, `creationTime` varchar(255) NOT NULL, `deleted` tinyint(4) NOT NULL DEFAULT '0', `_lastModified` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), PRIMARY KEY (`id`), KEY `ind_teamId` (`teamId`), KEY `ind_userId` (`userId`), KEY `ind_dbsync` (`_lastModified`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;"); | |||
await queryRunner.query("CREATE TABLE IF NOT EXISTS `d_b_project` (`id` char(36) NOT NULL, `cloneUrl` varchar(255) NOT NULL, `teamId` char(36) NOT NULL, `appInstallationId` varchar(255) NOT NULL, `creationTime` varchar(255) NOT NULL, `deleted` tinyint(4) NOT NULL DEFAULT '0', `_lastModified` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), PRIMARY KEY (`id`), KEY `ind_teamId` (`teamId`), KEY `ind_dbsync` (`_lastModified`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;"); | |||
await queryRunner.query("CREATE TABLE IF NOT EXISTS `d_b_project` (`id` char(36) NOT NULL, `name` varchar(255) NOT NULL, `cloneUrl` varchar(255) NOT NULL, `teamId` char(36) NOT NULL, `appInstallationId` varchar(255) NOT NULL, `creationTime` varchar(255) NOT NULL, `deleted` tinyint(4) NOT NULL DEFAULT '0', `_lastModified` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), PRIMARY KEY (`id`), KEY `ind_teamId` (`teamId`), KEY `ind_dbsync` (`_lastModified`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you plan to manually update the staging DB?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point! this is already on staging.
yes, it would be best to do a manual update.
@@ -1205,6 +1208,27 @@ export interface Project { | |||
deleted?: boolean; | |||
} | |||
|
|||
export interface ProjectInfo { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why copying the whole Project
shape instead of referencing it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just learned that DBProject
isn't implementing Project
at all.
So, yeah it doesn't make sense to duplicate.
Besides that, we introduced xInfo
shapes to augment entities, to make it works nicer with the frontend.
//#region Projects concerns | ||
// | ||
async getProviderRepositoriesForUser(params: { provider: string, hints?: object }): Promise<ProviderRepository[]> { | ||
const user = this.checkAndBlockUser("getProviderRepositoriesForUser"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this method should go the respective GitProvider impl. We should not add dependencies to GitHub (octokit) across our code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 for moving out. I'm thinking of a GitHubAppSupport
injectable.
FYI we have two octokit dependencies
- first in our GitHub support (auth provider, context parsers, etc.)
- second comes in via probot
Both parts live in different contexts. More specifically: the GitHub support is instantiated per Git Provider host.
BTW it's impossible impractical to sync both octokit versions both. Also, obtaining GH App's authenticated API (octokit) is done via GitHubApp.server.probotApp.auth()
.
|
||
const project: Project = { | ||
id: uuidv4(), | ||
name, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Since name
is also used as a slug
, maybe validate it here against a regex? For example like so (maybe without spaces):
gitpod/components/gitpod-db/src/typeorm/team-db-impl.ts
Lines 74 to 76 in 903c854
if (!/^[A-Za-z0-9 _-]+$/.test(name)) { | |
throw new Error('Please choose a team name containing only letters, numbers, -, _, or spaces.'); | |
} |
e961ad6
to
0fa4916
Compare
0fa4916
to
5cab5b8
Compare
This PR introduces the project creation flow (gitpod.io/new)
GH App Change
/api/apps/github/setup
route introduced here.Preview environment
The URL is https://at-select-repo.staging.gitpod-dev.com/new
werft run github -s chart/values.yaml -f
, where the provided values should contain the GH App config. In addition, a secret with the private key of the GH App should be created like thiskubectl create secret generic server-github-app-cert ...
New Project
The drop-down list contains the user's account by default. If the GH App is installed on Orgs of the users and the user granted
read:org
permissions, these accounts should be visible as well.Select Git Provider
Reconfigure GH App installations
You will see the GH App configuration in a pop-up window. For the preview environment this is a test app of mine.
Select a team
Listing of all teams of a user.
List projects of a team
This is a starting point for the Projects overview.
Closes #4352